package com.example.designpatterns.project.idempotent.idempotence;

/**
 * @author yanyun zhu
 * @version 1.0
 * @date 2022/1/21 8:55
 */
public class Idempotence {

    private IdempotenceStorage storage;

    public Idempotence(IdempotenceStorage storage) {
        this.storage = storage;
    }

    public boolean saveIfAbsent(String idempotenceId) {
        return storage.saveIfAbsent(idempotenceId);
    }

    public void delete(String idempotenceId) {
        storage.delete(idempotenceId);
    }
}
